<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> 
<head>
<%@ include file="../../include/easyui.jsp" %>
<%@ include file="../../include/pGrid.jsp" %>
<title>数据字典管理</title>
<script>
	$(function(){
		/*标记列表为树形*/
		p.isTreeGrid = true;
		p.dataGrid = $(p.dataGrid).treegrid($.extend({},p.dataGridParam,{
			columns:[[
	            {"field":"dicCode","width":120,"title":"字典编码"},
	            {"field":"dicName","width":120,"title":"字典名称"},
	            {"field":"pCode","width":120,"title":"父字典名称"},
	            {"field":"dicValue","width":120,"title":"字典值"},
	            {"field":"dicOrder","width":120,"title":"字典排序"}
            ]],
            pagination:false,//禁用分页
			idField: "treeId", 
			treeField: "dicCode",
			queryParams:{isTreeGrid:"true", treeId:"id", treePid:"parentId" }
		}));
		
		$("#toolbar .easyui-linkbutton").on("click", function() {
			var id = $(this).attr("motion_code");
			switch(id){
				case "01":
					var rows = p.dataGrid.datagrid('getSelections'), len = rows.length;
					var data = {parentId : "" , pmenuName : "无" }; 
					if(len>0){
						var row = rows[0] ;
						data = { parentId: row.id || "" , pmenuName: row.dicName || "无" , pCode: row.dicCode };
					}
					p.gridAdd({ title : "字典新增", width : 400, height : 320,data: data });
					break;
				case "02":
					p.gridModify({title : "字典编辑" ,width : 400, height : 270 });
					break;
				case "03":
					p.gridDelete();
					break;
				case "05":
					p.gridQuery();
					break;
				default: 
					p.tip({msg: $(this).text() +'未添加响应事件！'}); break;
			}
		});
	});
</script>
</head>
<body  class="easyui-layout">
		<!-- 但行高度33px，多行时 33乘以行数  -->
		<div id="querybar" data-options="region:'north',split:false,border:false" style="height:33px;">
			<div class="easyui-panel" data-options="fit:true,border:false"  >
				<form id="queryForm" >
				 <input type="hidden" name="className" value="com.fs.base.pojo.Dictionary" />
				 <div style="margin-top:5px;margin-left:10px;float:left;">
				  <input class="easyui-textbox" name="dicCode" style="width:240px;" data-options="label:'字典编码:',required:false" />
				<input type="hidden" name="dicCode_searchType" value="like" />
				 </div>
				 <div style="margin-top:5px;margin-left:10px;float:left;">
				  <input class="easyui-textbox" name="dicName" style="width:240px;" data-options="label:'字典名称:',required:false" />
				<input type="hidden" name="dicName_searchType" value="like" />
				 </div>
				 <div style="margin-top:5px;margin-left:10px;float:left;">
				  <input class="easyui-textbox" name="dicValue" style="width:240px;" data-options="label:'字典值:',required:false" />
				<input type="hidden" name="dicValue_searchType" value="like" />
				 </div>
				</form>
			</div>
		</div>  
	
		<!-- 工具栏 -->
		<div id="toolbar" class="easyui-panel" style="padding:3px;"></div>
		
		<!-- 表格 --> 
		<div region="center" border="false">
			<table id="dataGrid"></table>
		</div>
</body>
</html>